<template>
  


<el-form :model="barcodeData" label-width="90px" >

 <span
          style="
            text-align: center;
            font-size: 20px;
            font-weight: bold;
            display: inline-block;
            width: 100%;
            padding: 3px 0 5px 0;
          "
        >
          <span>扫描入库</span>
 </span>
     <el-form-item label="条码：">

       <el-input ref="barcode" v-model="barcodeData.barcode" @keyup.enter.native="confirmData"></el-input>    

     </el-form-item>

<el-form-item label="扫描记录">

 <el-input type="textarea"
  :rows="15"
  placeholder=""
  v-model="barcodeData.barcodeList">></el-input>   
</el-form-item>
  
</el-form>


</template>

<script>
import {UpdateForm} from '@/api/MesWH/PoInbarcode';

export default {
    name:"barcodeForm",

     data(){
         //表单查询一般分为input，下拉框，和日期，下面是下拉框时的设置下拉信息的情况，我的项目没有用到，但是留着方便看
      
        return {
      
        barcodeData: {
        // 查询条件
         barcode:"", // 总记录数
         barcodeList: "", // 一页显示的记录数
        
      },
        }

}, mounted(){
    this.$refs['barcode'].focus;
},    
methods:
{
    async confirmData() {
      // 提交数据，需要修改

      const Fresult = true;
     
        const result = await UpdateForm({
          billID: this.barcodeData.barcode,
          IsPostBack: true,

        });

       
        if (result.code === 20000) {
        this.barcodeData.barcodeList+="\n"+this.barcodeData.barcode+" 扫描成功"
         this.barcodeData.barcode=""
          this.$notify({
            title: result.msg,
            dangerouslyUseHTMLString: true,
            message: "",
            type: "success",
          });
         
            
        } else {
        this.barcodeData.barcodeList+="\n"+this.barcodeData.barcode+result.msg
        this.barcodeData.barcode=""
          this.$notify({
            title: result.msg,
            dangerouslyUseHTMLString: true,
            message: "",
            type: "error",
          });
          
        }
      }
    
}
}
</script>

<style>

</style>
        >
        

